﻿using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using zijian666.Data;
using System.Data;
using System.Data.SqlClient;
using System.Linq;

namespace demo
{
    class Program
    {
        static void Main(string[] args)
        {
            Diagnostic.IsDebug = false;

            //DiagnosticListener.AllListeners.Subscribe(new DiagnosticObserver());

            var mysql = Environment.GetEnvironmentVariable("mydb", EnvironmentVariableTarget.User).Split(",");

            using var conn = new MySqlConnection($"Server={mysql[0]};Port={mysql[1]};Database={mysql[2]};Uid={mysql[3]};Pwd={mysql[4]};");

            var wechat = conn.ExecuteFirst($"select * from wechats where ID in ({new[] { 1, 2, 3, 4 }}) limit 1");

            Console.WriteLine(wechat);

            var wechats = conn.ExecuteList($"select * from wechats where ID in ({new[] { 1, 2, 3, 4 }})");
            wechats.ForEach(Console.WriteLine);

        }



    }
}
